<!DOCTYPE html>
<html lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head th:include="/common/inc::header"/>
<body>
<form class="layui-form" style="margin-top: 15px">
    <div class="layui-form-item">
        <label class="layui-form-label" style="width: 60px">考生名字:</label>
        <div class="layui-input-inline">
            <input type="text" name="examName" id="examName" autocomplete="off"
                   class="layui-input">
        </div>
        <label class="layui-form-label" style="width: 60px">时间:</label>
        <div class="layui-input-inline">
            <input type="text" name="startTime" id="startTime"
                   class="layui-input">
        </div>
        <div class="layui-input-inline">
            <input type="text" name="endTime" id="endTime"
                   class="layui-input">
        </div>
        <button class="layui-btn" id="searchBtn" lay-submit lay-filter="searchBtn">查询</button>
    </div>
</form>
<table class="layui-table" id="grid" lay-filter="grid">
</table>
<script th:replace="/common/inc::incJs"></script>
<script>
    var allStr;

    $(function () {
        var tableIns = createTable({
            url: 'list',
            cols: [[{field: 'id', title: '系统编号', width: 150},
                {field: 'examineeSubject', title: '考试名称', width: 250}, {
                    field: 'examName',
                    title: '考生姓名',
                    width: 160
                }, {
                    field: 'idCard',
                    title: '身份证号',
                    width: 160
                }, {
                    field: 'isOperation',
                    title: '是否有实操',
                    width: 120,
                    templet: '#operationTpl'
                }, {
                    field: 'theoryScore',
                    title: '理论成绩',
                    width: 120
                }, {
                    field: 'operationScore',
                    title: '实操成绩',
                    width: 120
                }, {
                    field: 'status',
                    title: '类型',
                    width: 120,
                    templet: '#statusTpl'
                }, {
                    field: 'institutions',
                    title: '培训机构',
                    width: 120
                }, {
                    field: 'profession',
                    title: '工种',
                    width: 120
                }, {
                    field: 'createTime',
                    title: '时间',
                    width: 180
                }
            ]]
        });

        layui.table.on('tool(grid)', function (obj) { //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
            var data = obj.data; //获得当前行数据
            var layEvent = obj.event; //获得 lay-event 对应的值
            var tr = obj.tr; //获得当前行 tr 的DOM对象
            if (layEvent === 'edit') { //编辑
                openDialog({
                    url: "/backend/security/examineeHall/detail?id=" + data.id,
                    area: ["85%", "90%"]
                });
            } else if (layEvent === 'setAll') { //编辑
                openDialog({
                    url: "/backend/security/examineeHall/setAll?id=" + data.id,
                    area: ["65%", "60%"]
                });
            }
        });

        layui.form.on('submit(addBtn)', function () {
            openDialog({
                url: "/backend/security/exami  neeHall/detail",
                area: ["85%", "90%"]
            });
            return false;
        });


        layui.form.on('submit(searchBtn)', function (data) {
            tableIns.reload({
                where: data.field
            });
            return false;
        });
    })
</script>
<script type="text/html" id="operationTpl">
    {{#  if(d.isOperation ===1){ }}
    <span style="color: green;">有</span>
    {{#  } else { }}
    <span style="color: #FF0000;">无</span>
    {{#  } }}
</script>
<script type="text/html" id="statusTpl">
    {{#  if(d.status ===0){ }}
    <span style="color: green;">初试</span>
    {{#  } else if(d.status ===1){ }}
    <span style="color: blue;">复试</span>
    {{#  } else if(d.status ===2){ }}
    <span style="color: red;">补考</span>
    {{#  } }}
</script>
</body>
</html>
